//
//  NewsViewController.m
//  yonghu
//
//  Created by 浪尖渝力 on 2018/2/5.
//  Copyright © 2018年 com.DJS. All rights reserved.
//

#import "NewsViewController.h"
#import "newsView.h"
@interface NewsViewController ()
@property(nonatomic,strong)NewsView *aView;
@end

@implementation NewsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    _aView=[NewsView new];
    [self.view addSubview:_aView];
    [_aView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.left.right.mas_equalTo(0);
    }];
    _aView.tableArr=[NSMutableArray arrayWithCapacity:0];
    _aView.page=1;
    [_aView creatView];
    _aView.viewController=self;
    if (_message_type==nil||[_message_type isEqualToString:@"0"]) {
        _message_type=@"0";
       self.navigationItem.title=@"系统消息";
    }
    else{
         self.navigationItem.title=@"任务消息";
    }
    [self loadData];
    
  
}
-(void)loadData{
    NSDictionary *userDic = [NSKeyedUnarchiver unarchiveObjectWithFile:_userModelFile];
    NSString *token=[userDic objectForKey:@"token"];
    NSNumber *waiter_id1=[userDic objectForKey:@"waiter_id"];
    NSString *user_id=[NSString stringWithFormat:@"%@",waiter_id1];
    NSDictionary *dic=[NSDictionary dictionaryWithObjectsAndKeys:user_id,@"waiter_id",_message_type,@"message_type",@"0",@"mu_status",token,@"token",@"1",@"user_role", nil];
    [ZQTools AFNPostDataUrl:@"api/center/message_list" Dict:dic andTableView:nil andViewController:self andSuccessBlock:^(id responseObject) {
        
        NSArray *typeArr=responseObject;
        [_aView.tableArr addObjectsFromArray:typeArr];
        [_aView.tableView reloadData];
        
        
    } anderrorBlock:nil];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
